﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using YJKArchUtils.Utils;

namespace YJKElementFinish.ColumnSurface.Managers
{
	public class ParallelLinearWallComparer : IComparer<KeyValuePair<XYZ, Wall>>
	{
		public ParallelLinearWallComparer(XYZ ptRef)
		{
			this.m_ptRef = ptRef;
		}

		public int Compare(KeyValuePair<XYZ, Wall> lhv, KeyValuePair<XYZ, Wall> rhv)
		{
			double val = lhv.Key.DistanceTo(this.m_ptRef);
			double val2 = rhv.Key.DistanceTo(this.m_ptRef);
			if (Geometry.IsEqual(val, val2))
			{
				return 0;
			}
			if (Geometry.LessThan(val, val2))
			{
				return -1;
			}
			return 1;
		}

		private XYZ m_ptRef;
	}
}
